// 使用SockJS连接
var socket = new SockJS('http://localhost:10000/ws');
var stompClient = Stomp.over(socket);

stompClient.connect({'userId': 'user123'}, function(frame) {
// 订阅个人消息队列
stompClient.subscribe('/user/queue/messages', function(message) {
console.log('收到消息:', JSON.parse(message.body));
});

// 订阅广播消息
stompClient.subscribe('/topic/broadcast', function(message) {
console.log('收到广播:', JSON.parse(message.body));
});
});